package cn.xuguowen.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

/**
 * ClassName: PageResult
 * Package: cn.xuguowen.entity
 * Description:
 *
 * @Author 徐国文
 * @Create 2023/2/26 15:05
 * @Version 1.0
 */
@Data
public class PageResult<T> implements Serializable {
    public static final Long serialVersionUID = 1L;

    private Long total;

    private Long size;

    private Long curredt;

    private Long pages;

    private List<T> records = Collections.emptyList();

    public void loadData(IPage<T> pageData) {
        this.setTotal(pageData.getTotal());
        this.setSize(pageData.getSize());
        this.setCurredt(pageData.getCurrent());
        this.setPages(pageData.getPages());
        this.setRecords(pageData.getRecords());
    }
}
